#!/bin/bash

docker login -u zhoulumin1988@foxmail.com registry.cn-shenzhen.aliyuncs.com -p chowmin3410
docker login -u fosilzhou -p chowmin3410

for imagepath in $(cat ./imagepath-cn.txt)
do
  imagename=$(echo $imagepath | awk -F '/' '{print $NF}')
  
  # pull拉取中心仓库镜像
  docker pull $imagepath

  # push到阿里云仓库
  docker tag $imagepath registry.cn-shenzhen.aliyuncs.com/fosilzhou/$imagename
  docker push registry.cn-shenzhen.aliyuncs.com/fosilzhou/$imagename

  # push到dockerhub
  docker tag $imagepath fosilzhou/$imagename
  docker push fosilzhou/$imagename
  
  # push到本地私有仓库

done
